<!doctype html>
<html>
{include file="head.html"}

<body>
<div class="fullscreen">
        <div class="scroll_content">
            <div class="topfixed">
                <div class="t_left"><a href="/index.php?m=koudai_order&a=myindex"><i class="back"></i></a></div>
                <div class="t_main">寝室订单分账管理</div>

            </div>
            <div class="paddingheight"></div>

        </div>
    </div>
    

    <ul class="global_tabs clearfix">
        <li style="width: 48.5%;" class="first cur"><a href="/index.php?m=koudai_order_fz&order_id={$order.order_id}">产品列表</a></li>

        <li style="width: 48.5%;" class="last"><a href="/index.php?m=koudai_order_fz&a=my&order_id={$order.order_id}">详细账单</a></li>
    </ul>
<form method="post" action="/index.php?m=koudai_order_fz&a=fzsave" >
<input type="hidden" name="order_id" value="{$order.order_id}">
    <ul class="cart_new_list clearfix">
    
        <li>
			{foreach item=c from=$order_product}
            <div class="list clearfix">
                <div class="cart_pic">
                    <a href=""><img src="{$c.imgurl|images_site}.100x100.jpg" onerror="err_imgurl(this)" class="img"></a>
                </div>
                <div class="cart_content">
                    <div class="tit">{$c.title}</div>
                    <div class="info">
                        <p class="fl">
                            <span class="num">￥{$c.price}&nbsp;&nbsp;&nbsp;&nbsp;{$c.jznum}件</span>
                        </p>

                        <p class="fr">
                           <sapn class="cart_num" price="{$c.price}">
                          
                           <a class="DisDe" href="javascript:void(0)"><i>-</i></a>
                           <input  name="jz[{$c.productid}]" readonly class="Amount" value="0" autocomplete="off" maxlength="3">
                           <a class="Increase" max="{$c.amount}" href="javascript:void(0)"><i>+</i></a></sapn>
                        </p>
                    </div>

                </div>
            </div>
            {/foreach}
             
            <div class="cart_total clearfix">
                <span class="fl">本次从寝室口袋挑选 <b class="red" id="total_num">0</b> 件产品，合计￥<b class="red" id="total_money">0</b></span>
                 

            </div>
            {if $fzuser}
            <div class="cart_total clearfix">
                <span class="fl">上次已分账 <b class="red" id="total_num">{$fzuser['num']}</b> 件产品，合计￥<b class="red" id="total_money">{$fzuser.money}</b></span>
                 

            </div>
            {/if}
        </li>

    </ul>
    <button id="jz-submit" type="submit" class="cart_change_btn">提交分账</button>
  </form>  
    
    <script>
        $(".cart_change_dl dd").click(function (e) {
            $(this).addClass("cur").siblings().removeClass("cur");
        });
        $(".DisDe").on("click",function(){
			var obj=$(this);
			var p=$(this).parents(".cart_num");
			var price=parseFloat(p.attr("price"));
			var  total_num=parseInt($("#total_num").html());
			var total_money=parseFloat($("#total_money").html());
			var v=parseInt(p.find(".Amount").val());
			v=v-1;
			if(v<0){
				 
			}else{
				p.find(".Amount").val(v);
				$("#total_num").html(total_num-1);
				$("#total_money").html(total_money-price);
			}
		});
		
		$(".Increase").on("click",function(){
			var obj=$(this);
			var p=$(this).parents(".cart_num");
			var price=parseFloat(p.attr("price"));
			var  total_num=parseInt($("#total_num").html());
			var total_money=parseFloat($("#total_money").html());
			var v=parseInt(p.find(".Amount").val());
			var mx=parseInt($(this).attr("max"));
			v=v+1;
			if(v>mx){
				skyToast('不能大于'+mx+"件")
			}else{
				p.find(".Amount").val(v);
				$("#total_num").html(total_num+1);
				$("#total_money").html(total_money+price);
			}
			
		});
         
    </script>

</body>
</html>
